Mule : Vm Provider
This page last changed on Jul 27, 2006 by aperepel.
The vm connector is used for intra-vm communication between components managed by Mule. The connector provides options for configuring vm transient or persistent queues. The javadoc for this provider can be found here. VM Connector Properties
Using VM QueuesWhen using a synchronous VM endpoint events are delivered in memory from one component to another (asynchronous endpoints introduce an event queue that threads can consume from). However, when the 'queueEvents' property is set, events can be stored in arbitary memory queues and consumed later by clients or components. furthermore these queues can be persistent and XA transactional (see below). To use VM Queues the 'queueEvents' property must be set on the connector and all VM endpoints that should queue events must use a VM connector that has queueEvents enabled. You cannot set the 'queueEvents' property on the endpoint, it can only be set at the connector level. i.e. <connector name="vmQueue" className="org.mule.providers.vm.VMConnector"> <properties> <property name="queueEvents" value="true"/> </properties> </connector> <model name="TestModel"> <mule-descriptor name="TestComponent" implementation="org.mule.components.simple.PassThroughComponent"> <inbound-router> <endpoint address="vm://test.queue" connector="vmQueue"/> </inbound-router> </mule-descriptor> </model> Notice that the endpoint explicitly tells Mule to use the vmQueue connector. Otherwise Mule will look for the first connector that matches the protocol for the endpoint. Using Persistent QueuesVM queue can be made persistent so that its state can be maintained between server shutdowns. To make VM queues persistent you must set a persistence strategy in the Mule Xml configuration. This strategy is shared for all VM queues in Mule instance. <mule-environment-properties> <queue-profile persistent="true" maxOutstandingMessages="1000"/> <persistence-strategy className="org.mule.util.queue.FilePersistenceStrategy"/> </mule-environment-properties> Note you must add a <queue-profile> element for the VM queue configuration and you must also add a <persistence-strategy> that tells mule how to persist the events. If a <persistence-strategy> is not set, Mule will use the default in-memory persistence strategy. Users can write their own persistence strategies to write to a database or some other store if required. Persistence strategies must implement QueuePersistenceStrategy. Using TransactionsVM Queues support Transactions and can take part in distributed XA transactions. To make a VM queue endpoint transactional use the following configuration - <endpoint address="vm://test.queue" connector="vmQueue"> <transaction action="BEGIN_OR_JOIN" factory="org.mule.providers.vm.VMTransactionFactory"/> </endpoint> You will also need to add a transaction manager to your configuration. For more information see Transaction Management. EndpointsVM endpoints are 'resource' endpoints in that they just name a resource, there is not host or other configuration required. For example - vm://myComponent
Points to an address called 'myComponent', anything listening on vm://myComponent will receive events dispatched on vm://myComponent. When using VM queues the notation is the same. TransformersThere are no specific transformers for the VM transport. |
Document generated by Confluence on Nov 27, 2006 10:27 |